<%@ page import="com.zzty.entity.User" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>个人竞赛批改作业</title>
    <link rel="stylesheet" href="../css/style.default.css" type="text/css"/>
    <script type="text/javascript" src="../js/jquery-1.7.min.js"></script>
    <script type="text/javascript" src="../js/jquery-ui-1.8.16.custom.min.js"></script>
    <script type="text/javascript" src="../js/jquery.cookie.js"></script>
    <script type="text/javascript" src="../js/jquery.alerts.js"></script>
    <script type="text/javascript" src="../js/jquery.uniform.min.js"></script>
    <script type="text/javascript" src="../js/general.js"></script>
    <script type="text/javascript" src="../js/blog.js"></script>

    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

    <!--[if lte IE 8]>
    <script language="javascript" type="text/javascript" src="../js/plugins/excanvas.min.js"></script><![endif]-->
    <!--[if IE 9]>
    <link rel="stylesheet" media="screen" href="../css/style.ie9.css"/>
    <![endif]-->
    <!--[if IE 8]>
    <link rel="stylesheet" media="screen" href="../css/style.ie8.css"/>
    <![endif]-->
    <!--[if lt IE 9]>
    <script src="../js/plugins/css3-mediaqueries.js"></script>
    <![endif]-->
    <script src="../js/ajaxAPI.js"></script>
    <script type="text/javascript">
        var path = '<%=request.getContextPath()%>';

        function init() {
            var transactionId = document.getElementsByTagName("p")[0].innerHTML;
            ajaxCall("POST", path + "/SelfExamServlet?method=getContentByTransactionId&transactionId=" + transactionId, setContent);

        }

        function setContent(res) {
            var obj = JSON.parse(res);
            for(var i in obj){

                var fileNames = document.getElementById("fileNames");
                var odiv=document.getElementById("myContent");
                if (i == 0) {
                    fileNames.innerHTML += "<li class='active'><a href='#"+i+"' data-toggle='tab'>"+ obj[i].fileName +"</a></li>";
                    odiv.innerHTML +="<div class='tab-pane fade in active' id='"+i+"'><pre>"+obj[i].workContent+"</pre></div>";
                }
                else {
                    fileNames.innerHTML += "<li><a href='#"+i+"' data-toggle='tab'>"+ obj[i].fileName+"</a></li>";
                    odiv.innerHTML+="<div class='tab-pane fade' id='"+i+"'><pre>"+obj[i].workContent+"</pre></div>";
                }
            }

        }

        function setGrade() {
            var transactionId = document.getElementsByTagName("p")[0].innerHTML;
            var score=0;
            var radio = document.getElementsByName("rScore");
            for (i = 0; i < radio.length; i++) {
                if (radio[i].checked) {
                    score = radio[i].value;
                }
            }
            ajaxCall("POST",path+"/SelfExamServlet?method=setGrade&score="+score+"&transactionId="+ transactionId,info);
        }
        function info() {
            window.location.href="selfCorrectHomework.jsp";
            alert("添加成功");
        }

    </script>
    <script src="../js/change.js"></script>
</head>

<body class="withvernav" onload="init()">
<div class="bodywrapper">
    <div class="topheader">
        <div class="left">
            <h1 class="logo"><span>ZZTY</span></h1>
            <span class="slogan">自在天原学习系统</span>


            <br clear="all"/>

        </div><!--left-->
        <% User user = (User) session.getAttribute("user");
        %>
        <div class="right">
            <!--<div class="notification">
                <a class="count" href="ajax/notifications.html"><span>9</span></a>
            </div>-->
            <div class="userinfo">
                <img src="../images/thumbs/avatar.png" alt=""/>
                <span><%=user.getName()%></span>
            </div><!--userinfo-->

            <div class="userinfodrop">
                <div class="avatar">
                    <a href=""><img src="../images/thumbs/avatarbig.png" alt=""/></a>

                </div><!--avatar-->
                <div class="userdata">

                    <ul>
                        <li>名字:<%=user.getName()%>
                        </li>
                        <li>班级:java<%=user.getClassId()%>班</li>
                        <li>邮箱:<%=user.getEmail()%>
                        </li>
                        <li>类型:<%=user.getType()%>
                        </li>
                        <li><a href="change.jsp">修改信息</a></li>
                        <li><a href="../login.jsp">退出</a></li>
                    </ul>
                </div><!--userdata-->
            </div><!--userinfodrop-->
        </div><!--right-->
    </div><!--topheader-->


    <div class="header">
        <ul class="headermenu">
            <li><a href="Tmain.jsp"><span class="icon icon-flatscreen"></span>首页</a></li>
            <li><a href="teamExam.jsp"><span class="icon icon-pencil"></span>结对</a></li>
            <li class="current"><a href="competion.jsp"><span class="icon icon-message"></span>竞赛</a></li>
            <li><a href="share.jsp"><span class="icon icon-chart"></span>课堂分享</a></li>
        </ul>


    </div><!--header-->

    <div class="vernav">
        <ul>
            <li><a href="competion.jsp" class="editor">布置作业</a></li>
            <li class="current"><a href="selfCorrectHomework.jsp">批改作业</a></li>
            <li><a href="selfStudentScore.jsp">学生成绩</a></li>

        </ul>
        <a class="togglemenu"></a>
    </div><!--leftmenu-->

    <div class="centercontent" onload="init()">
        <% Integer transactionId =Integer.valueOf(request.getParameter("transactionId")) ;
        System.out.println("transactionId :"+transactionId);
        %>
        <p hidden id="transactionId"><%=transactionId%>
        </p>

        <div class="pageheader">
            <h1 class="pagetitle">批改作业</h1>
            <span class="pagedesc">个人竞赛批改作业</span>


            <span class="pagedesc">
                <hr/>


            </span>
        </div><!--pageheader-->

        <div id="contentwrapper" class="contentwrapper">

            <%--<div>--%>
                <%--<textarea id="tcontent" name="elm1" rows="15" cols="80" style="width: 80%" class="tinymce">--%>
                <%--</textarea>--%>
            <%--</div><br/>--%>
            评分：
            <input type="radio" name="rScore" value="1">1分
            <input type="radio" name="rScore" value="2">2分
            <input type="radio" name="rScore" value="3">3分
            <input type="radio" name="rScore" value="4">4分
            <input type="radio" name="rScore" value="5">5分
            <input type="button" value="提交" onclick="setGrade()"/>
            <input type="button" value="返回" onclick="window.location='selfCorrectHomework.jsp'"/>
            <ul id="fileNames" class="nav nav-tabs">
            </ul>
            <div id="myContent" class="tab-content">
            </div>
            </div>


        </div><!--contentwrapper-->

        <br clear="all"/>

    </div><!-- centercontent -->


</div><!--bodywrapper-->
<!-- 模态框 -->


<style>
    td {
        text-align: left;
        vertical-align: top;

    }
    input[type="button"] {
        width: auto;
        margin: 0;
        font-weight: bold;
        color: #eee;
        background: #fb9337;
        border: 1px solid #50627f;
        padding: 7px 10px;
        -moz-box-shadow: none;
        -webkit-box-shadow: none;
        box-shadow: none;
        cursor: pointer;
        -moz-border-radius: 2px;
        -webkit-border-radius: 2px;
        border-radius: 2px;
    }
</style>

</body>
</html>
